/*
 * TCPServerConnectionWrapper.h
 *
 *  Created on: Sep 11, 2017
 *      Author: zjf
 */

#ifndef SRC_TCPSERVERCONNECTIONWRAPPER_H_
#define SRC_TCPSERVERCONNECTIONWRAPPER_H_

#include <Poco/Net/TCPServerConnection.h>
#include <Poco/NotificationQueue.h>

using namespace Poco;
using namespace Poco::Net;

#include "TCPServerPacket.h"
#include "TCPServerPacketReaderWriter.h"
#include "TCPServerPacketParams.h"
#include "TCPServerPacketReceiverWrapper.h"
#include "TCPServerChannel.h"

namespace network
{

class TCPServerConnectionWrapper: public TCPServerConnection
{
public:
	using TPacketParams = TCPServerPacketParams<TCPServerDispatcherPacket, TCPServerPacketReaderWriter>;

	TCPServerConnectionWrapper(std::vector<TCPServerChannel::Ptr>& vecChannels, StreamSocket& sock);
	virtual ~TCPServerConnectionWrapper();

	void run();

private:
	std::vector<TCPServerChannel::Ptr>& _vecChannels;
	TCPServerPacketReaderWriter _rw;
	TCPServerPacketReceiverWrapper<TCPServerPacket, TCPServerPacketReaderWriter> _io;
};

} /* namespace network */

#endif /* SRC_TCPSERVERCONNECTIONWRAPPER_H_ */
